package com.cu.employmentmanagementsystem.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.cu.employmentmanagementsystem.common.result.R;
import com.cu.employmentmanagementsystem.entity.Admin;
import com.cu.employmentmanagementsystem.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
@SaCheckLogin
@SaCheckRole("admin")
public class AdminController {
    @Autowired
    private AdminService adminService;
    @RequestMapping("/insert")
    public void insert(Admin admin) {
        adminService.insert(admin);
    }
    @RequestMapping("/delete")
    public void delete(Long id) {
        adminService.deleteById(id);
    }
    @RequestMapping("/update")
    public void update(Admin admin) {
        adminService.update(admin);
    }
    @RequestMapping("/select")
    public R<Admin> select(Long id) {
       return R.success(adminService.queryById(id));
    }
}
